[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
<% if @docker_socket.nil? %>
After=network-online.target firewalld.service
<% else %>
After=network-online.target <%= @docker_name %>.socket firewalld.service
Requires=<%= @docker_name %>.socket
<% end %>
Wants=network-online.target

[Service]
Type=notify
<% if @config.http_proxy %>
Environment="HTTP_PROXY=<%= @config.http_proxy %>"
<% end %>
<% if @config.https_proxy %>
Environment="HTTPS_PROXY=<%= @config.https_proxy %>"
<% end %>
<% if @config.no_proxy %>
Environment="NO_PROXY=<%= @config.no_proxy %>"
<% end %>
<% if @config.tmpdir %>
Environment="TMPDIR=<%= @config.tmpdir %>"
<% end %>
<% @env_vars.each do |key, val| %>
Environment="<%= key %>=<%= val %>"
<% end unless @env_vars.nil? %>
<% if @config.ipv4_forward %>
ExecStartPre=/sbin/sysctl -w net.ipv4.ip_forward=1
<% end %>
<% if @config.ipv6_forward %>
ExecStartPre=/sbin/sysctl -w net.ipv6.conf.all.forwarding=1
<% end %>
ExecStart=<%= @docker_daemon_cmd %>
ExecStartPost=<%= @docker_wait_ready %>
ExecReload=/bin/kill -s HUP $MAINPID
<% if @config.mount_flags %>
MountFlags=<%= @config.mount_flags %>
<% end %>
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=always
StartLimitBurst=3
StartLimitInterval=60s
<%= @systemd_args  %>

[Install]
WantedBy=multi-user.target
